import {
  handleRequest
} from './index'
import request2 from '@/utils/request2'
import request from '@/utils/request'
import {
  projectApiUrl,
  safetyApiUrl
} from '../config'

// 获取-交底记录列表
export function getSafteyRecordList(data) {
  return request2({
    url: safetyApiUrl + '/safe-confess/record/list',
    method: 'post',
    data
  })
}

// 获取-交底记录统计
export function getSafteyRecordCount(data) {
  return request2({
    url: safetyApiUrl + '/safe-confess/count',
    method: 'post',
    data
  })
}


// 查看-交底记录详情
export function getSafteyRecordDetail(params) {
  return request2({
    url: safetyApiUrl + '/safe-confess/record/details',
    method: 'get',
    params
  })
}


// 查看-交底记录详情
export function getSafteyRecordDetailPrint(params) {
  return handleRequest({
    url: '/safe-confess/record/details/print',
    method: 'get',
    params
  })
}

// 查看-WBS
export function getWBS(params) {
  return request({
    url: projectApiUrl + '/construction/master-plan/details/by-project',
    method: 'get',
    params
  })
}


// 新增-交底记录
export function addSafteyRecord(data) {
  return handleRequest({
    url: '/safe-confess/record',
    method: 'post',
    data
  })
}

// 新增-交底记录
export function addSafteyRecord2(data) {
  return request2({
    url: safetyApiUrl + '/safe-confess/record',
    method: 'post',
    data
  })
}

// 修改-交底记录
export function updateSafteyRecord2(data) {
  return request2({
    url: safetyApiUrl + '/safe-confess/record/update',
    method: 'post',
    data
  })
}

// 修改-交底记录
export function updateSafteyRecord(data) {
  return handleRequest({
    url: '/safe-confess/record/update',
    method: 'post',
    data
  })
}

// 删除-交底记录
export function deleteSafteyRecord(params) {
  return handleRequest({
    url: '/safe-confess/record/del',
    method: 'post',
    params
  })
}

// 删除-交底记录
export function deleteSafteyRecord2(params) {
  return request2({
    url: safetyApiUrl + '/safe-confess/record/del',
    method: 'post',
    params
  })
}

// 月安全交底计划记录--签到列表
//safe-confess/recordSignList/{confessRecordId}
export function recordSignList(params) {
  return request2({
    url: safetyApiUrl + '/safe-confess/recordSignList/' + params.id,
    method: 'get',
    params
  })
}

// 月安全交底计划记录--大屏二维码
export function selectMeetConfig(params) {
  return request2({
    url: safetyApiUrl + '/safe-confess/selectMeetConfig/' + params.id,
    method: 'get',
    params
  })
}